import socket

talk_server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
talk_server.bind(("127.0.0.1", 8887))
while True:
    data, addr = talk_server.recvfrom(1024)
    rev_msg = data.decode("utf-8")
    print("客户：", rev_msg)
    if rev_msg == 'exit':
        break
    rev = input("客服:")
    talk_server.sendto(rev.encode(), addr)

talk_server.close()
